package team.sun.sss.dao.staff;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import team.sun.sss.pojo.staff.StaffTrain;

import java.util.List;

@Mapper
@Repository
public interface StaffTrainDao {

    @Select("select * from staff_train")
    List<StaffTrain> getStaffTrain();

    @Select("select * from staff_train where sta_num=#{staNum}")
    List<StaffTrain> getStaffTrainById(String staNum);

    @Delete("delete from staff_train where train_id=#{trainId}")
    int deleteStaffTrain(int trainId);

    @Insert("insert into staff_train(train_name,train_unit,train_time,sta_num) values(#{trainName},#{trainUnit},#{trainTime},#{staNum})")
    int addStaffTrain(StaffTrain staffTrain);

    @Update("update staff_train set train_name=#{trainName},train_unit=#{trainUnit},train_time=#{trainTime},sta_num=#{staNum} where train_id=#{trainId}")
    int updateStaffTrain(StaffTrain staffTrain);
}
